package org.litepal.exceptions;

/**
 * When LitePal deals with CRUD actions of DataSupport, it may throw
 * DataSupportException.
 * 
 * @author Tony Green
 * @since 1.1
 */
public class DataSupportException extends RuntimeException {
	private static final long serialVersionUID = 1L;

	/**
	 * Thrown when a security manager check fails.
	 */
	public static final String SECURITY_EXCEPTION = "SecurityException.";

	/**
	 * A method is invoked with an argument which it can not reasonably deal
	 * with.
	 */
	public static final String ILLEGAL_ARGUMENT_EXCEPTION = "A method is invoked with an argument which it can not reasonably deal with.";

	/**
	 * Thrown when the VM notices that a program tries to reference, on a class
	 * or object, a method that does not exist.
	 */
	public static final String NO_SUCH_METHOD_EXCEPTION = "There're some methods you invoked that do not exist.";

	/**
	 * Thrown when the virtual machine notices that a program tries to
	 * reference, on a class or object, a field that does not exist.
	 */
	public static final String NO_SUCH_FIELD_EXCEPTION = "There're some fields you invoked that do not exist.";

	/**
	 * Thrown when a program attempts to access a field or method which is not
	 * accessible from the location where the reference is made.
	 */
	public static final String ILLEGAL_ACCESS_EXCEPTION = "IllegalAccessException";

	/**
	 * This class provides a wrapper for an exception thrown by a Method or
	 * Constructor invocation.
	 */
	public static final String INVOCATION_TARGET_EXCEPTION = "InvocationTargetException";

	/**
	 * Thrown when a program attempts to access a constructor which is not
	 * accessible from the location where the reference is made.
	 */
	public static final String INSTANTIATION_EXCEPTION = "InstantiationException";

	/**
	 * Thrown when models have invalid type for id fields. Only int or long is
	 * supported.
	 */
	public static final String ID_TYPE_INVALID_EXCEPTION = "id type is not supported. Only int or long is acceptable for id";

	/**
	 * Thrown when the saving model is not an instance of DataSupport.
	 */
	public static final String MODEL_IS_NOT_AN_INSTANCE_OF_DATA_SUPPORT = " should be inherited from DataSupport";

	/**
	 * Thrown when developers use wrong field to declare many2one or many2many
	 * associations.
	 */
	public static final String WRONG_FIELD_TYPE_FOR_ASSOCIATIONS = "The field to declare many2one or many2many associations should be List or Set.";

	/**
	 * Constructor of DataSupportException.
	 * 
	 * @param errorMessage
	 *            the description of this exception.
	 */
	public DataSupportException(String errorMessage) {
		super(errorMessage);
	}
}
